import http from '@/utils/http'

const BASE_URL = '/jobfair/conferenceInfo'

export interface JobfairResp {
  id: string
  title: string
  startDate: string
  endDate: string
  location: string
  status: string
  createUserString: string
  updateUserString: string
}
export interface JobfairDetailResp {
  id: string
  title: string
  description: string
  startDate: string
  endDate: string
  location: string
  status: string
  createTime: string
  updateTime: string
  createUser: string
  updateUser: string
  createUserString: string
  updateUserString: string
}
export interface JobfairQuery {
  title: string
  status: string
  sort: Array<string>
}
export interface JobfairPageQuery extends JobfairQuery, PageQuery {}

/** @desc 查询双选会信息列表 */
export function listJobfair(query: JobfairPageQuery) {
  return http.get<PageRes<JobfairResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询双选会信息详情 */
export function getJobfair(id: string) {
  return http.get<JobfairDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增双选会信息 */
export function addJobfair(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 修改双选会信息 */
export function updateJobfair(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除双选会信息 */
export function deleteJobfair(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 导出双选会信息 */
export function exportJobfair(query: JobfairQuery) {
  return http.download<any>(`${BASE_URL}/export`, query)
}


/** @desc 查询参会企业 */
export function searchCompany(jobfairId: string){
  return http.get(`${BASE_URL}/companyList/${jobfairId}`)
}

/** @desc 企业报名参加双选会 */
export function companySignUp(jobfairId: string) {
  return http.get<String>(`${BASE_URL}/companySignUp/${jobfairId}`)
}